package com.nanhai.buddhist.college.module.collegebase.dal.mysql.accommodationroom;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.accommodationroom.AccommodationRoomDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.accommodationroom.vo.*;

/**
 * 房间 Mapper
 *
 * @author AKai
 */
@Mapper
public interface AccommodationRoomMapper extends BaseMapperX<AccommodationRoomDO> {

    default PageResult<AccommodationRoomDO> selectPage(AccommodationRoomPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccommodationRoomDO>()
                .likeIfPresent(AccommodationRoomDO::getRoomName, reqVO.getRoomName())
                .eqIfPresent(AccommodationRoomDO::getCollegeId, reqVO.getCollegeId())
                .eqIfPresent(AccommodationRoomDO::getDepartmentId, reqVO.getDepartmentId())
                .eqIfPresent(AccommodationRoomDO::getFloorId, reqVO.getFloorId())
                .eqIfPresent(AccommodationRoomDO::getRoomStatus, reqVO.getRoomStatus())
                .orderByDesc(AccommodationRoomDO::getCreateTime));
    }

    default List<AccommodationRoomDO> selectList(AccommodationRoomExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AccommodationRoomDO>()
                .likeIfPresent(AccommodationRoomDO::getRoomName, reqVO.getRoomName())
                .eqIfPresent(AccommodationRoomDO::getCollegeId, reqVO.getCollegeId())
                .eqIfPresent(AccommodationRoomDO::getFloorId, reqVO.getFloorId())
                .eqIfPresent(AccommodationRoomDO::getRoomStatus, reqVO.getRoomStatus())

                .orderByDesc(AccommodationRoomDO::getCreateTime));
    }

}
